home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 2868 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.4 KB

  1. Path: prairienet.org!sjmccaug
  2. From: sjmccaug@prairienet.org (Scott J. McCaughrin)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: [Q] Dynamically allocating memory for a char*
  5. Date: 20 Jan 1996 03:58:19 GMT
  6. Organization: University of Illinois at Urbana
  7. Message-ID: <4dpp8r$5sv@vixen.cso.uiuc.edu>
  8. References: <ALUN.CHAMPION.96Jan19155029@g7240065.bridge.bst.bls.com> <4dmn1i$10t@walrus2.walrus.com>
  9. Reply-To: sjmccaug@prairienet.org (Scott J. McCaughrin)
  10. NNTP-Posting-Host: firefly.prairienet.org
  11.  
  12.  
  13. In a previous article, Alun.Champion@bridge.bst.bls.com (Alun Champion) says:
  14.  
  15. >In article <NITIN.96Jan19095012@more.eng.sun.com> nitin@more.eng.sun.com (Nitin More [CONTRACTOR]) writes:
  16. >
  17. >: [original attribution not included in response]
  18. >: > I have a question about allocating memory for a string as it's passed
  19. >: > in by the user.  I'm using cin to get the info, but maybe this is
  20. >: > inappropriate.  I have included the relevant snippets of the file
  21. >: > below.  What I am trying to achieve is no limitation for the user when
  22. >: > they input a path + filename.  Is it possible to use char* foo and
  23. >: > then something like (I know this is wrong, but the idea of it ...)
  24. >
  25.  Isn't this one of the prime motives for using linked lists? Decide on a
  26.  size for each node (= no. of chars) and add on new links dynamlically
  27.  until the string is read in, then collapse the nodes into one char array!
  28.  
  29.  -- Scott McC.
  30.  
  31.